package proj3;

import misc.not_Legal_Exception;
import evolution_superclasses.Genotype;
import evolution_superclasses.Phenotype;

public class Proj3_Genotype extends Genotype {
	private String _binaryString;

	public Proj3_Genotype(int size) {
		super(size);
	}

	public String get_binaryString() {
		return _binaryString;
	}

	public void set_binaryString(String binaryString) {
		_binaryString = binaryString;
	}

	@Override
	public void createGenotype(int size) throws not_Legal_Exception {
		String s = "";
		while(size-->0)
			s += _rand.nextBoolean()?"1":"0";
		_binaryString = s;
	}

	public Phenotype generateAndVisualizePhenotype() {
		set_phenotype(new Proj3_Phenotype(this, true));
		return get_phenotype();
	}

	@Override
	public Phenotype generatePhenotype() {
		set_phenotype(new Proj3_Phenotype(this));
		return get_phenotype();
	}

	@Override
	public String toString() {
		return _binaryString;
	}

}
